package me.jessyan.armscomponent.app.mvp.model.mine;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import javax.inject.Inject;

import io.reactivex.Observable;
import me.jessyan.armscomponent.commonsdk.core.ResultCodeHub;
import me.jessyan.armscomponent.commonsdk.http.BaseResponse;
import me.jessyan.armscomponent.app.mvp.contract.mine.MineMyNotesContract;
import me.jessyan.armscomponent.app.mvp.model.entity.NoteItem;


/**
 * <p>
 * Author: Taozebi
 * Date: 09/08/2021 20:47
 * Description: describe of this class
 */
@ActivityScope
public class MineMyNotesModel extends BaseModel implements MineMyNotesContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public MineMyNotesModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<BaseResponse<List<NoteItem>>> getMyNotesList() {
        return getList();
    }

    private Observable<BaseResponse<List<NoteItem>>> getList() {
        List<NoteItem> list = new ArrayList<>();
        NoteItem bean = new NoteItem();
        bean.setUserName("李大富");
        bean.setPhone("02786574567");
        bean.setAddress("武汉市江夏区高新四路万科魅力之城北区十五区");
        bean.setDefault(true);
        list.add(bean);

        bean = new NoteItem();
        bean.setUserName("金克丝");
        bean.setPhone("02786574567");
        bean.setAddress("武汉市江夏区高新四路万科魅力之城北区十五区");
        bean.setDefault(false);
        list.add(bean);

        bean = new NoteItem();
        bean.setUserName("安楠");
        bean.setPhone("02786574567");
        bean.setAddress("武汉市江夏区高新四路万科魅力之城北区十五区");
        bean.setDefault(false);
        list.add(bean);


        bean = new NoteItem();
        bean.setUserName("二仙桥");
        bean.setPhone("02786574567");
        bean.setAddress("武汉市江夏区高新四路万科魅力之城北区十五区");
        bean.setDefault(false);
        list.add(bean);


        BaseResponse<List<NoteItem>> response = new BaseResponse<>();
        response.setResult(list);
        response.setPage(1);
        response.setPageCount(10);
        response.setCode(ResultCodeHub.CODE_0);
        return Observable.just(response).delay(2, TimeUnit.SECONDS);
    }
}